package com.tengju.user.infrastructure.repository.convert;

import com.tengju.user.domain.model.archive.sign.SelfCertification;
import com.tengju.user.domain.model.archive.sign.SelfCertificationId;
import com.tengju.user.domain.model.archive.sign.SelfCertificationStatus;
import com.tengju.user.domain.model.archive.sign.SelfCertificationType;
import com.tengju.user.domain.model.user.UserIdCode;
import com.tengju.user.infrastructure.persistence.mybatis.dataobject.SelfCertificationDO;

public class SelfCertificationConvert {

    public static SelfCertification convertToModel(SelfCertificationDO selfCertificationDO) {
        if (selfCertificationDO == null) {
            return null;
        }
        return new SelfCertification(new SelfCertificationId(selfCertificationDO.getId()),
                SelfCertificationStatus.fromVal(selfCertificationDO.getStatus()),
                SelfCertificationType.fromVal(selfCertificationDO.getType()),
                selfCertificationDO.getRemark(),
                new UserIdCode(selfCertificationDO.getIdCode()),
                selfCertificationDO.getCompanyName(),
                selfCertificationDO.getCompanyAddress(),
                selfCertificationDO.getCompanyTel(),
                selfCertificationDO.getCompanyNo(),
                selfCertificationDO.getIdCardType(),
                selfCertificationDO.getIdCardName(),
                selfCertificationDO.getIdCardNo(),
                selfCertificationDO.getIdCardImage(),
                selfCertificationDO.getBankNo(),
                selfCertificationDO.getBankName(),
                selfCertificationDO.getBusinessImg(),
                selfCertificationDO.getLicenceImg(),
                selfCertificationDO.getLegalMobile());
    }
}
